package com.azxc.rapid.plus.system.feign;

import com.azxc.rapid.core.launch.constant.AppConstant;
import com.azxc.rapid.core.tool.api.R;
import com.azxc.rapid.system.entity.Dept;
import com.azxc.rapid.system.entity.Region;
import com.azxc.rapid.system.entity.Role;
import com.azxc.rapid.system.entity.SystemConfig;
import com.azxc.rapid.system.vo.DeptVO;
import com.azxc.rapid.system.vo.RegionVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author linym
 * @className: ISysPlusClient
 * @description:
 * @date 2022/8/23 15:09
 * @version：1.0
 */
@FeignClient(
	value = "rapid-core-plus",
	fallback = ISysPlusClientFallback.class
)
public interface ISysPlusClient {
	String API_PREFIX = "/client-plus";
	String DEPTS = API_PREFIX + "/getListDeptById";
	String REGIONVO = API_PREFIX + "/getRegionVOById";
	String REGION_LIST = API_PREFIX + "/getListRegionById";

	String SYSTEM_CONFIG = API_PREFIX + "/getSystemConfig";
	String GET_DEPT_LIST = API_PREFIX + "/getListDeptByRegionCode";

	String GET_DEPTIDS_BY_NAME = API_PREFIX + "/getDeptIdsByName";

	String GET_DEPT_LAZY_TREE=API_PREFIX + "/getDeptLazyTree";

	String GET_DEPT_BY_ID_LIST = API_PREFIX + "/dept/get-dept-by-id-list";

	String GET_USER_INFO_ENT_ID = API_PREFIX + "/user-info-by-ent-id";

	String REGIONCODE_TYPE = API_PREFIX + "/getDeptByRegionCodeAndType";

	String DEPT_BY_PARENTID = API_PREFIX + "/deptByParentId";

	String GET_ROLE_BY_ID = API_PREFIX + "/role/get-by-id";

	String GET_ROLE_BY_CODE = API_PREFIX + "/role/get-by-code";

	String REGION_BY_TYPE = API_PREFIX + "/getRegionByType";

	/**
	 * 根据部门id,获取部门上级的list部门-行政区划关联
	 *
	 * @param deptId
	 * @return
	 */
	@GetMapping(DEPTS)
	R<List<DeptVO>> getListDeptById(@RequestParam("deptId") String deptId);


	/**
	 * 根据部门id，查询部门对应的行政区划
	 *
	 * @param deptId
	 * @return
	 */
	@GetMapping(REGIONVO)
	R<RegionVO> getRegionVOById(@RequestParam("deptId") String deptId);


	@GetMapping(REGION_LIST)
	R<List<Region>> getListRegionById(@RequestParam("code") String code);


//	@GetMapping(SYSTEM_CONFIG)
//	R<SystemConfig> getSystemConfig(@RequestParam("type") Integer type);


	/**
	 * 根据行政区划code，获取绑定的机构List
	 *
	 */
	@GetMapping(GET_DEPT_LIST)
	R<List<DeptVO>> getListDeptByRegionCode(@RequestParam("regionCode") String regionCode);

	@GetMapping(GET_DEPTIDS_BY_NAME)
	R<String> getDeptIds(@RequestParam("tenantId")String tenantId,@RequestParam("deptNames") String deptNames);

	@GetMapping(GET_DEPT_LAZY_TREE)
	R<List<DeptVO>> getDeptLazyTree(@RequestParam("deptId")Long  deptId);

	/**
	 * 根据多个id查询部门
	 *
	 * @param ids id集合
	 * @return
	 */
	@GetMapping(GET_DEPT_BY_ID_LIST)
	R<List<Dept>> getDeptByIdList(@RequestParam("ids") String ids);

	@GetMapping(REGIONCODE_TYPE)
	R<Long> getDeptByRegionCodeAndType(@RequestParam("regionCode") String regionCode,
									   @RequestParam("type") String type);

	/**
	 * 根据父级id获取子部门ID
	 *
	 * @param parentId
	 * @return
	 */
	@GetMapping(DEPT_BY_PARENTID)
	R<List<Dept>> deptByParentId(@RequestParam("parentId") Long parentId);

	/**
	 * 根据ID查询角色
	 *
	 * @param id id
	 * @return Dept
	 */
	@GetMapping(GET_ROLE_BY_ID)
	R<Role> getRoleById(@RequestParam Long id);

	/**
	 * 根据ID查询角色
	 *
	 * @param code id
	 * @return Dept
	 */
	@GetMapping(GET_ROLE_BY_CODE)
	R<Role> getRoleByCode(@RequestParam String code);

	@GetMapping(REGION_BY_TYPE)
	R<List<Region>> regionByType(@RequestParam("type") String type,
								 @RequestParam("parentCode") String parentCode);

}
